#ifndef ATK_MW8266D
#define ATK_MW8266D

#include "stm32f10x.h"
#include "config.h"
#include "bsp_uart.h"

#if MW8266D_ENABLE

#define ESP8266D_USART(fmt, ...)    usart_printf(USART3, fmt, ##__VA_ARGS__)

#define MW8266D_UART_RX_BUF_SIZE    128
#define MW8266D_UART_TX_BUF_SIZE    64

#define MW8266D_PIN    GPIO_Pin_14

/* 错误代码 */
#define MW8266D_EOK         0   /* 没有错误 */
#define MW8266D_ERROR       1   /* 通用错误 */
#define MW8266D_ETIMEOUT    2   /* 超时错误 */
#define MW8266D_EINVAL      3   /* 参数错误 */

uint8_t mw8266d_AT_test(void);
uint8_t mw8266d_init(u32 bound);
uint8_t mw8266d_restore(void);
uint8_t mw8266d_set_mode(uint8_t mode);
uint8_t mw8266d_sw_reset(void);
uint8_t mw8266d_ate_config(uint8_t cfg);
uint8_t mw8266d_join_ap(char *ssid, char *pwd);
uint8_t mw8266d_get_ip(char *buf);
bool fire_mw8266d_send_AT_cmd(char *cmd, char *reply1, char *reply2, uint32_t timeout);
void fire_mw8266d_AT_test(void);

#endif

#endif

